class Base{
  baseUrl="https://api.hibai.cn/api/";
  getDataSet(e, key) {
    return e.currentTarget.dataset[key];
  }

  request(id,callback){
    wx.request({
      url: this.baseUrl+"index/index",
      method: "post",
      data: {
        "TransCode": "020111",
        "OpenId": "test",
        "Body": {
          "SongListId":id
        }
      },
      header: {
        'content-type': 'application/json'
      },
      success:callback,
      fail:function(res){
        console.log(res);
      }
    });
  }

  //获取用户信息
  getUserInfo(callback){
    wx.getUserInfo({
      lang:"zh_CN",
      success:function(res){
        callback&&callback(res.userInfo);
      }
    })
  }
}

export {Base};